﻿
@{
    ViewData["Title"] = "图表";
}


<div class="form-group">
    <label for="message">内容:</label>
    <textarea rows="5" cols="20" id="message" name="message" class="form-control"></textarea>
</div>

<div class="form-group">
    <textarea class="form-control" id="content" rows="10"></textarea>
</div>
<input type="button" id="send" value="发送">

<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/js/signalr.js"></script>
<script src="~/js/chatstart.js"></script>


<script type="text/javascript">

      connection.on("ReceiveMessage", function (data) {
         
        var encodedMsg =   data.msg;
        $("#content").append("服务器返回数据：" + encodedMsg + "\n");
    });



    //发送消息
    $("#send").on("click", function () {
        var message = $.trim($("#message").val());
        var params = {};
        params.message = message;
        $.ajax({
            url: '/Echart/sendmsg',
            type: 'post',
            data: params,
            dataType: 'json',
            async: true,
            success: function (data) {
                if (data.code == 'success') {
                    alert(data.msg);
                }
                else {
                    alert("发送失败");
                }
            }
        });
    });

     

</script>